// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf

#include "MgcRenderer.h"
#include "MgcPolypoint.h"

MgcImplementRTTI(MgcPolypoint,MgcGeometry);
MgcImplementStream(MgcPolypoint);

//---------------------------------------------------------------------------
MgcPolypoint::MgcPolypoint (unsigned int uiVertexQuantity,
    MgcVector3* akVertex, MgcVector3* akNormal, MgcColor* akColor,
    MgcVector2* akTexture)
    :
    MgcGeometry(uiVertexQuantity,akVertex,akNormal,akColor,akTexture)
{
    m_uiActiveQuantity = uiVertexQuantity;
}
//---------------------------------------------------------------------------
MgcPolypoint::MgcPolypoint ()
{
    m_uiActiveQuantity = 0;
}
//---------------------------------------------------------------------------
void MgcPolypoint::UpdateModelNormals ()
{
    // Points have no geometric neighbor information that would allow
    // automatic construction of normals.
}
//---------------------------------------------------------------------------
void MgcPolypoint::Draw (MgcRenderer& rkRenderer)
{
    MgcGeometry::Draw(rkRenderer);
    rkRenderer.Draw(*this);
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// streaming
//---------------------------------------------------------------------------
MgcObject* MgcPolypoint::Factory (MgcStream& rkStream)
{
    MgcPolypoint* pkObject = new MgcPolypoint;
    MgcStream::Link* pkLink = new MgcStream::Link(pkObject);
    pkObject->Load(rkStream,pkLink);
    return pkObject;
}
//---------------------------------------------------------------------------
void MgcPolypoint::Load (MgcStream& rkStream, MgcStream::Link* pkLink)
{
    MgcGeometry::Load(rkStream,pkLink);

    // native data
    MgcStreamRead(rkStream,m_uiActiveQuantity);
}
//---------------------------------------------------------------------------
void MgcPolypoint::Link (MgcStream& rkStream, MgcStream::Link* pkLink)
{
    MgcGeometry::Link(rkStream,pkLink);
}
//---------------------------------------------------------------------------
bool MgcPolypoint::Register (MgcStream& rkStream)
{
    return MgcGeometry::Register(rkStream);
}
//---------------------------------------------------------------------------
void MgcPolypoint::Save (MgcStream& rkStream)
{
    MgcGeometry::Save(rkStream);

    // native data
    MgcStreamWrite(rkStream,m_uiActiveQuantity);
}
//---------------------------------------------------------------------------
